
var itcast = {
    // 获取路由名称
    getRouterName: (str) => {
        let index = str.indexOf('?') // 查询参数标记
        let routerName = ''
        if (index == -1) { // 说明没有参数
            routerName = str.substring(str.lastIndexOf('/') + 1)
        } else {
            routerName = str.substring(str.lastIndexOf('/') + 1, str.indexOf('?'))
        }
        return routerName
    },
    // 将url参数做成键值对
    getparameter: (str) => {
        str = str.substring(1);
        let temp = str.split('&')
        let obj = {}
        for (i = 0; i < temp.length; i++) {
            let arr = temp[i].split('=');
            obj[arr[0]] = arr[1]
        }

        return obj
    }
}